/*
*** (C) 2008 UCMai.com ***

Subj: ZYT BASE
Auth: zhouyongtai
Date: 2011-01-03
*/

var zyt = {version:"1.0"};
zyt.dw = function(str){document.write(str);}
zyt.dw('<div id="loading-mask"></div><div id="loading"></div>');

zyt.cookies = {};

zyt.cookies.set = function(name, value){
	var argv = arguments;
	var argc = arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : '/';
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
		((expires==null) ? "" : ("; expires=" + expires.toGMTString())) +
		((path==null) ? "" : ("; path=" + path)) +
		((domain==null) ? "" : ("; domain=" + domain)) +
		((secure==true) ? "; secure" : "");
};

zyt.cookies.get = function(name){
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = document.cookie.indexOf('zyt_app_') + 9;
	var j = document.cookie.indexOf(arg, i) + arg.length;
	var k = document.cookie.indexOf('&', j); 
	return decodeURIComponent(document.cookie.substring(j, k));
	/*
	while(i < clen){
		j = i + alen;
		alert(document.cookie.substring(i, j));
		if (document.cookie.substring(i, j) == arg)
			return Cookies.getCookieVal(j);

		i = document.cookie.indexOf(" ", i) + 1;
		if(i == 0)
			break;
	}
	return null;*/
};

zyt.cookies.clear = function(name) {
	if(Cookies.get(name)){
		document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
};

zyt.cookies.getVal = function(offset){
	var endstr = document.cookie.indexOf(";", offset);
	if(endstr == -1){
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
};

/*
定义配置包含类
*/
zyt.config = {};
zyt.config.cssDesktop = '<link rel="stylesheet" type="text/css" href="/jlib/main.css" />';
zyt.config.cssExtAll = '<link rel="stylesheet" type="text/css" href="/jlib/ext/resources/css/ext-all.css" />';
/*-- region LIBS--*/
zyt.config.jsExtBase = '<script type="text/javascript" src="/jlib/ext/adapter/ext/ext-base.js"></script>';
zyt.config.jsExtAll = '<script type="text/javascript" src="/jlib/ext/ext-all.js"></script>';
/*-- endRegion --*/
/*-- region 系统变量，定义的枚举值及公共方法--*/
zyt.config.jsExtLang = '<script type="text/javascript" src="/jlib/ext/build/locale/ext-lang-zh_CN.js"></script>';
zyt.config.jsCommon = '<script type="text/javascript" src="/jlib/common_ext.js"></script>';
/*-- endRegion --*/

/*-- region Load UX--*/
zyt.config.jsLoadUX = '<script type="text/javascript" src="/jlib/ux/load_ux.js"></script>';


/*-- endRegion --*/

/*-- region Sysframework --*/
zyt.config.jsSF = '';
/*-- region desktop--*/
//zyt.config.jsApp = '<script type="text/javascript" src="/jlib/SF/App.js"></script>';
//zyt.config.jsModule = '<script type="text/javascript" src="/jlib/SF/Module.js"></script>';
//zyt.config.jsDesktop = '<script type="text/javascript" src="/jlib/SF/Desktop.js"></script>';
/*-- endRegion --*/
/*-- region serverdifine--*/
zyt.config.jsServerdefine = '<script type="text/javascript" src="/jsClass/serverdefine.js"></script>';
/*-- endRegion --*/

//zyt.config.jsSF = zyt.cookies.get("ali") == 0 ? '' : zyt.config.jsApp + zyt.config.jsModule + zyt.config.jsDesktop;

zyt.configLoader = function(){
	zyt.dw(
		zyt.config.cssDesktop +
		zyt.config.cssExtAll +
		zyt.config.jsExtBase +
		zyt.config.jsExtAll +
		zyt.config.jsExtLang + 
		zyt.config.jsServerdefine + 
		zyt.config.jsCommon + 
		/*-- region load ux--*/
		zyt.config.jsLoadUX 
		/*-- endRegion --*/
		/*-- region 载入desktop--*/
		//zyt.config.jsSF 
		/*-- endRegion --*/
		
	);
}();
